## 最长无重复字串
class Solution:
    def lengeststr(self, s: str) -> int:
        window = {} #s[i]  times
        left,right = 0,0
        maxl = 0
        while right<len(s):

            #扩大窗口
            c = s[right]
            right += 1
            ##更新窗口
            if c in window:
                window[c] += 1
            else:
                window[c] = 1
            ##收缩
            while window[c]>1:
                d = s[left]
                left += 1
                window[d] -= 1
            ### 更新结果，此时一定无重复
            if right-left>maxl:
                maxl = right-left
        return maxl

s = input()
S = Solution()
print(S.lengeststr(s))





